package com.guo.pet_store.controller;

import com.guo.pet_store.admin.service.PetService;
import net.bytebuddy.asm.Advice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class DetailController {
    @Autowired
    PetService petService;
    //根据商品返回细节
    @RequestMapping("/detail/{id}")
    public String getDetail(@PathVariable Long id, Model model){
        model.addAttribute("pet",petService.getOnePet(id));
        return "single";
    }
}
